/*
*  Copyright 2019-2025 Zheng Jie
*
*  Licensed under the Apache License, Version 2.0 (the "License");
*  you may not use this file except in compliance with the License.
*  You may obtain a copy of the License at
*
*  http://www.apache.org/licenses/LICENSE-2.0
*
*  Unless required by applicable law or agreed to in writing, software
*  distributed under the License is distributed on an "AS IS" BASIS,
*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*  See the License for the specific language governing permissions and
*  limitations under the License.
*/
package me.zhengjie.gas.dto;

import lombok.Data;
import cn.hutool.core.bean.BeanUtil;
import io.swagger.annotations.ApiModelProperty;
import cn.hutool.core.bean.copier.CopyOptions;
import javax.persistence.*;
import javax.validation.constraints.*;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.time.LocalDateTime;

/**
* @website https://eladmin.vip
* @description /
* @author Joe Tan
* @date 2025-08-14
**/
@Entity
@Data
@Table(name="dtu_device")
public class DtuDevice implements Serializable {

    @Id
    @Column(name = "`id`")
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @ApiModelProperty(value = "id")
    private Integer id;

    @Column(name = "`dept_id`",nullable = false)
    @NotNull
    @ApiModelProperty(value = "dept_id")
    private Long deptId;

    @Column(name = "`device_name`")
    @ApiModelProperty(value = "device_name")
    private String deviceName;

    @Column(name = "`device_mac`",nullable = false)
    @NotNull
    @ApiModelProperty(value = "device_mac")
    private String deviceMac;

    @Column(name = "`device_imei`")
    @ApiModelProperty(value = "device_imei")
    private String deviceImei;

    @Column(name = "`is_active`")
    @ApiModelProperty(value = "is_active")
    private Boolean isActive;

    @Column(name = "`remark`")
    @ApiModelProperty(value = "remark")
    private String remark;

    @Column(name = "`created_ts`",nullable = false)
    @NotNull
    @ApiModelProperty(value = "created_ts")
    private LocalDateTime createdTs;

    @Column(name = "`created_by`")
    @ApiModelProperty(value = "created_by")
    private String createdBy;

    @Column(name = "`last_updated_ts`",nullable = false)
    @NotNull
    @ApiModelProperty(value = "last_updated_ts")
    private LocalDateTime lastUpdatedTs;

    @Column(name = "`last_updated_by`")
    @ApiModelProperty(value = "last_updated_by")
    private String lastUpdatedBy;

    public void copy(DtuDevice source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }
}
